package jtokyotyrant;

import java.util.List;
import java.util.Map;

public interface RDBQRY {
	/** query condition: string is equal to */
	int QCSTREQ  	=  	0;
	/** query condition: string is included in */
	int QCSTRINC 	= 	1;
	/** query condition: string begins with */
	int QCSTRBW 	= 	2;
	/** query condition: string ends with */
	int QCSTREW 	= 	3;
	/** query condition: string includes all tokens in */
	int QCSTRAND 	= 	4;
	/** query condition: string includes at least one token in */
	int QCSTROR 	= 	5;
	/** query condition: string is equal to at least one token in */
	int QCSTROREQ 	= 	6;
	/** query condition: string matches regular expressions of */
	int QCSTRRX 	= 	7;
	/** query condition: number is equal to */
	int QCNUMEQ 	= 	8;
	/** query condition: number is greater than */
	int QCNUMGT 	= 	9;
	/** query condition: number is greater than or equal to */
	int QCNUMGE 	= 	10;
	/** query condition: number is less than */
	int QCNUMLT 	= 	11;
	/** query condition: number is less than or equal to */
	int QCNUMLE 	= 	12;
	/** query condition: number is between two tokens of */
	int QCNUMBT 	= 	13;
	/** query condition: number is equal to at least one token in */
	int QCNUMOREQ 	= 	14;
	/** query condition: full-text search with the phrase of */
	int QCFTSPH 	= 	15;
	/** query condition: full-text search with all tokens in */
	int QCFTSAND 	= 	16;
	/** query condition: full-text search with at least one token in */
	int QCFTSOR 	= 	17;
	/** query condition: full-text search with the compound expression of */
	int QCFTSEX 	= 	18;
	/** query condition: negation flag */
	int QCNEGATE 	= 	1 << 24;
	/** query condition: no index flag */
	int QCNOIDX 	= 	1 << 25;
	/** order type: string ascending */
	int QOSTRASC 	= 	0;
	/** order type: string descending */
	int QOSTRDESC 	= 	1;
	/** order type: number ascending */
	int QONUMASC 	= 	2;
	/** order type: number descending */
	int QONUMDESC 	= 	3;
	/** set operation type: union */
	int MSUNION 	= 	0;
	/** set operation type: intersection */
	int MSISECT 	= 	1;
	/** set operation type: difference */
	int MSDIFF 	= 	2;

	void addcond(String name, int op, String expr);
	void setorder(String name, int type);
	void setlimit(int max, int skip);
	List<byte[]> search();
	List<String> search2();
	boolean searchout();
	/**
	 * @return result["\0"] = pkey
	 */
	List<Map<String, byte[]>> searchget();
	List<Map<String, String>> searchget2();
	
	int searchcount();
	
	String hint();
	
	List<byte[]> metasearch(RDBQRY[] qrys, int type);
	List<String> metasearch2(RDBQRY[] qrys, int type);

	/**
	 * @return result["\0"] = pkey
	 */
	List<Map<String, byte[]>> parasearch(RDBQRY[] qrys);
	List<Map<String, String>> parasearch2(RDBQRY[] qrys);
	
}
